package game.block.screen;

import game.block.Locator;
import game.block.game.Board;

import java.util.ArrayList;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;

public class BlackScreen implements Screen{

    private float time;
    private boolean render;
    private Board board;
    public BlackScreen(Board board){
        this.board=board;
        time=0;
        render=true;
    }
    
    @Override
    public void render(float delta) {
        ShapeRenderer sh=new ShapeRenderer();
        sh.begin(ShapeType.Filled);
        sh.setColor(0, 0, 0,1);
        sh.rect(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        sh.end();
        time+=delta;
        if(time > 0.5f && render){
            board.undo();
            Board.SPAWN = true;
            board.setPause(false);
            
            ArrayList<TransitionEffect> effects = new ArrayList<TransitionEffect>();

            //effects.add(new FadeOutTransitionEffect(0.25f));
            effects.add(new FadeInTransitionEffect(0.5f));

            Screen transitionScreen = new TransitionScreen(Locator.getGame(), this, board.getScreen(), effects);
            Locator.getGame().setScreen(transitionScreen);
            render=false;
        }
    }

    @Override
    public void resize(int width, int height) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void show() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void hide() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void pause() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void resume() {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void dispose() {
        // TODO Auto-generated method stub
        
    }

}
